package br.com.financeiro.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import br.com.financeiro.dao.GenericDao;

@Component @Transactional
public class CrudService<T> {

	@Autowired
	private GenericDao dao;
	
	public void salvarOuAtualizar(T obj){
		dao.salvarOuAtualizar(obj);
	}
	
	public void remover(T obj){
		dao.remover(obj);
	}
	
	public T buscar(Integer id, Class<T> classe){
		return dao.buscar(id, classe);
	}
	
	public List<T> findAll(Class<T> classe){
		return dao.listar(classe, null);
	}
	
	/*public Integer countAll(Class<T> classe){
		return dao.
	}*/
	
}
